package com.mingqijia.gassafety.shared.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 服务套餐
 * @author: duanhongxiang
 * @Desc:
 * @create: 2024-10-21 10:37
 **/
@Getter
@RequiredArgsConstructor
public enum ServicePkgEnum {
    SMALL_BELL_ALERT("1","报警监控大屏中设备发生报警时，小铃铛闪烁提醒，点击可消音"),
    AUTO_LOCATE_IN("2","报警监控大屏中设备发生报警时，地图中显示报警信息弹窗并自动定位到报警设备"),
    SYSTEM_SMALL_TRUMPET_ALARM("3","报警监控系统中设备发生报警时，小喇叭警报提醒，点击可消音"),
    SYSTEM_POP_ALARM("4","报警监控系统中设备发生报警时，系统页面中出现弹窗并显示报警状态"),
    ALERT_UNNEED_HANDEL("5","报警信息无需处理，状态在报警结束后，自动更新为无需处理（报警恢复)，报警原因为“无（设备报警恢复后，状态更新为无需处理）”"),
    BROKEN_UNNEED_HANDEL("6","故障信息无需处理，状态为“无需处理”");

    private final String code;
    private final String desc;

    public static String getStateName(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (ServicePkgEnum pkgEnum : ServicePkgEnum.values()) {
            if (StringUtils.equals(pkgEnum.code, code)) {
                return pkgEnum.desc;
            }
        }
        return null;
    }

    public static Map<String, String> getMap() {
        Map<String, String> areaEnumMap = new HashMap<>();
        for (ServicePkgEnum areaEnum : ServicePkgEnum.values()) {
            areaEnumMap.put(areaEnum.code, areaEnum.desc);
        }
        return areaEnumMap;
    }
}
